package biolabs.util;

import java.util.AbstractCollection;
import java.util.Collection;
import java.util.Iterator;

public class TransformingCollection<I, O> extends AbstractCollection<O> {

	private final Collection<? extends I> coll;
	private final Transformation<I,O> tr;

	public TransformingCollection(Collection<? extends I> coll, Transformation<I,O> tr){
		this.coll = coll;
		this.tr = tr;
	}

	@Override
	public Iterator<O> iterator() {
		return new TransformingIterator<I,O>(coll.iterator(), tr);
	}

	@Override
	public int size() {
		return coll.size();
	}

}
